package com.yunji.cabinet.mapper;

import com.github.yulichang.base.MPJBaseMapper;
import com.yunji.cabinet.domain.DeviceEventDO;
import com.yunji.cabinet.params.DeviceEventParam;
import com.yunji.common.annotation.DataScope;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @version 1.0
 * @Project: yunji-coffee
 * @Package com.yunji.cabinet.mapper
 * @FileName CabinetRecordsMapper.java
 * @Copyright Copyright © 2024 云集互联. All Rights Reserved
 * Company		com
 * @CreateTime 2024-03-30 19:50:14
 * @Description 操作日志记录数据交互
 * @Modification Author                    History Time			Version				Description
 * --------------------------------------------------------------------------------
 * ·HuaAo				2024-03-30 19:50:14		1.0					1.0 Version
 * @since JDK 1.8.0_202
 */
public interface DeviceMapper extends MPJBaseMapper<DeviceEventDO> {


    @DataScope
    @Select({"<script>SELECT DISTINCT ${param.searchFiled} FROM t_container_logs cl ",
            "<where><if test='param.containerName != null'>AND cl.container_name LIKE concat('%',#{param.containerName},'%')</if>",
            " <if test='param.userName != null'>AND cl.user_name LIKE concat('%',#{param.userName},'%')</if>",
            " <if test='param.siteName != null'>AND cl.site_name LIKE concat('%',#{param.siteName},'%')</if>",
            "</where></script>"})
    List<String> searchTableField(@Param("param") DeviceEventParam param);
}
